﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAO;
using DTO;
namespace BUS
{
    public class BaoCaoBus
    {
        public List<HoaDonDTO> xembaocao_theongay(HoaDonDTO bc)
        {
            DAOBaoCao bcda = new DAOBaoCao();
            return bcda.BaoCao_theoNgay(bc);
        }
        public List<HoaDonDTO> xembaocao_theothang(HoaDonDTO bc)
        {
            DAOBaoCao bcda = new DAOBaoCao();
            return bcda.baocao_theothang(bc);
        }
        public List<HoaDonDTO> xembaocao_theonam(HoaDonDTO bc)
        {
            DAOBaoCao bcda = new DAOBaoCao();
            return bcda.baocao_nam(bc);
        }
        public List<HoaDonDTO> xembaocaomon_theongay(HoaDonDTO bc,int gt)
        {
            DAOBaoCao bcda = new DAOBaoCao();
            return bcda.BaoCaomon_theoNgay(bc,gt);
        }
        public List<HoaDonDTO> xembaocaomon_theothang(HoaDonDTO bc,int gt)
        {
            DAOBaoCao bcda = new DAOBaoCao();
            return bcda.BaoCaomon_theothang(bc,gt);
        }
        public List<HoaDonDTO> xembaocaomon_theonam(HoaDonDTO bc,int gt)
        {
            DAOBaoCao bcda = new DAOBaoCao();
            return bcda.BaoCaomon_theonam(bc,gt);
        }
        public List<HoaDonDTO> xembaocaoban_theongay(HoaDonDTO bc, string gt)
        {
            DAOBaoCao bcda = new DAOBaoCao();
            return bcda.BaoCaoBan_theoNgay(bc, gt);
        }
        public List<HoaDonDTO> xembaocaoban_theothang(HoaDonDTO bc, string gt)
        {
            DAOBaoCao bcda = new DAOBaoCao();
            return bcda.BaoCaoBan_theothang(bc, gt);
        }
        public List<HoaDonDTO> xembaocaoban_theonam(HoaDonDTO bc, string gt)
        {
            DAOBaoCao bcda = new DAOBaoCao();
            return bcda.BaoCaoBan_theonam(bc, gt);
        }
        public List<HoaDonDTO> xembaocaokhuvuc_theongay(HoaDonDTO bc, string gt)
        {
            DAOBaoCao bcda = new DAOBaoCao();
            return bcda.BaoCaokhuvuc_theoNgay(bc, gt);
        }
        public List<HoaDonDTO> xembaocaokhuvuc_theothang(HoaDonDTO bc, string gt)
        {
            DAOBaoCao bcda = new DAOBaoCao();
            return bcda.BaoCaokhuvuc_theothang(bc, gt);
        }
        public List<HoaDonDTO> xembaocaokhuvuc_theonam(HoaDonDTO bc, string gt)
        {
            DAOBaoCao bcda = new DAOBaoCao();
            return bcda.BaoCaokhuvuc_theonam(bc, gt);
        }
        public int kiemtra(int ngay, int thang, int nam)
        {
            int[] songay = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
            if ((nam % 400 == 0) || (nam % 100 != 0 && nam % 4 == 0))
            {
                songay[2] = 29;
            }

            if (ngay <= songay[thang])
            {
                return 1;
            }
            else
                return 0;
        }
        public int getngay(int thang, int nam)
        {
            int[] songay = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
            if ((nam % 400 == 0) || (nam % 100 != 0 && nam % 4 == 0))
            {
                songay[2] = 29;
            }

            return songay[thang];
        }
        public int kiemtra_ngaynhap(DateTime ngaybd, DateTime ngaykt)
        {
            if (ngaybd > ngaykt)
            {
                return 0;
            }
            return 1;
        }
    }
   
}
